package com.maxd.controller.FreeOfCharge;

import com.maxd.adapter.IgnoreSecurity;
import com.maxd.error.Result;
import com.maxd.error.ResultUtil;
import com.maxd.service.FreeOfCharge.IFreeOfChargeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(value = "免单管理", tags = {"免单管理"})
@RequestMapping(value = "/freeOfCharge")
public class FreeOfChargeController {
    @Autowired
    private IFreeOfChargeService iFreeOfChargeService;

    @RequestMapping(value = "/selectList", method = RequestMethod.GET)
    @IgnoreSecurity
    @ApiOperation("获取免单列表")
    @ResponseBody
    public Result selectList(int page,int size) {
        Sort.Order order = new Sort.Order(Sort.Direction.DESC, "id");
        Pageable pageable = PageRequest.of(page, size, Sort.by(order));
        return ResultUtil.success(iFreeOfChargeService.selectFreeOfChargeList(pageable));
    }

}
